import request from '@/utils/request'

/**
 * 增加知识类型
 * @param {obj} data 知识类型内容
 */
export function createKonwledgeType(data) {
  return request({
    url: `/call-center/api/v1/knowledgeType`,
    method: 'POST',
    data
  })
}

/**
 * 修改知识类型
 * @param {obj} data 需修改的知识类型内容
 */
export function updateKonwledgeType(data) {
  return request({
    url: `/call-center/api/v1/knowledgeType`,
    method: 'PUT',
    data
  })
}

/**
 * 查询所有知识类型
 */
export function searchKonwledgeTypeAll() {
  return request({
    url: '/call-center/api/v1/knowledgeType/',
    method: 'GET'
  })
}
export function valideName(name) {
  return request({
    url: '/call-center/api/v1/knowledgeType/' + name,
    method: 'GET'
  })
}

/**
 * 分页查询知识类型
 */
export function konwledgeTypeListPage(data) {
  return request({
    url: '/call-center/api/v1/knowledgeType/page',
    method: 'post',
    data
  })
}

/**
 * 删除知识类型
 * @param {int} id 被删除知识类型ID
 */
export function deleteKonwledgeType(id) {
  return request({
    url: `/call-center/api/v1/knowledgeType/${id}`,
    method: 'DELETE'
  })
}

/**
 * 审核知识类型
 * @param {string} id 需审核知识类型ID
 * @param {int} state 审核状态
 */
export function auditKonwledgeType(data) {
  return request({
    url: `/call-center/api/v1/knowledgeType/audit`,
    method: 'POST',
    data
  })
}
